<!--消息提醒-->
<template>
  <div class="app-container">
    <el-table v-loading="loading" :data="messageList">
      <el-table-column label="消息名称" align="center" prop="name" width="160" :show-overflow-tooltip="true"/>
      <el-table-column label="消息所属" align="center" prop="belong" width="120" :show-overflow-tooltip="true"/>
      <el-table-column label="消息类型" align="center" prop="messageType" width="120" :show-overflow-tooltip="true"/>
      <el-table-column label="来自用户" align="center" prop="messageUserName" width="120" :show-overflow-tooltip="true"/>
      <el-table-column label="是否已提醒" align="center" prop="status" width="120" :show-overflow-tooltip="true"/>
      <el-table-column label="消息时间" align="center" prop="settlementTime" width="180" :show-overflow-tooltip="true">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.settlementTime, '{m}/{d}/{y}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="120">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="$router.push({ path: '/order/list', query: { orderId:scope.row.orderId } })"
            v-hasPermi="['car:message:edit']"
          >查看</el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.current"
      :limit.sync="queryParams.size"
      @pagination="getList"
    />

  </div>
</template>

<script>
import { listMessage, getMessage, delMessage, addMessage, updateMessage } from "@/api/order/message";

export default {
  name: "Message",
  data() {
    return {
      // 遮罩层
      loading: true,
      // 总条数
      total: 0,
      // 【请填写功能名称】表格数据
      messageList: [],
      queryParams:{
        size:10,
        current:1
      }
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询【请填写功能名称】列表 */
    getList() {
      this.loading = true;
      listMessage(this.queryParams).then(response => {
        this.messageList = response.data.records;
        this.total = response.data.total;
        this.loading = false;
      });
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids
      getMessage(id).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改【请填写功能名称】";
      });
    },
  }
};
</script>
